#include <iostream>

/**
 * C++ 指针数组
 */
const int MAX = 3;
void arr01();
void arr02();

//用到了三个整数，它们将存储在一个指针数组中
void arr01(){
    int var[MAX] = {10,100,200};
    int *ptr[MAX];

    for (int i = 0; i < MAX; ++i) {
        ptr[i] = &var[i];
    }

    for (int i = 0;i < MAX;i ++){
        std::cout << "Value of var[" << i << "] = ";
        std::cout << *ptr[i] << std::endl;
    }
}

//用一个指向字符的指针数组来存储一个字符串列表
void arr02(){
    const char *names[MAX] = {"Zara Ali","Hina Ali","Nuha Ali"};
    for (int i = 0;i < MAX;i++){
        std::cout << "Value of names[" << i << "] = ";
        std::cout << names[i] << std::endl;
    }

}

int main() {
    /*int var[MAX] = {10,200,300};
    for (int i = 0; i < MAX; ++i) {
        std::cout << "Value of var[" << i << "] = " << var[i] << std::endl;
    }*/

    arr02();

    return 0;
}

